import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.util.ArrayList;


public class AllNewSalesman {

	static BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
	//static BufferedReader reader;		
	
	public static void main(String[] args) throws Exception {
		//reader = new BufferedReader(new FileReader("salesman_input.txt"));
		new AllNewSalesman().run();

	}
	private void run() throws Exception {
		String line = reader.readLine();
		if(line.equals("END")) {reader.close(); return;}
		String[] split = line.split(" ");
		int towns = Integer.parseInt(split[0]);
		int roads = Integer.parseInt(split[1]);
		int origin = Integer.parseInt(split[2]);
		int destination = Integer.parseInt(split[3]);
			
		line = reader.readLine();
		String[] splitamounts = line.split(",");
		int[] amounts = new int[towns];
		for(int i=0; i< towns;i++)
			amounts[i] = Integer.parseInt(splitamounts[i]);
		
		ArrayList<int[]> adjacencies = new ArrayList<int[]>();
		for(int i = 0; i< roads; i++){
			line = reader.readLine();
			split = line.split(" ");
			int[] intsplit = new int[split.length]; 
			for(int j=0; j< split.length;j++)
				intsplit[j] = Integer.parseInt(split[j]);
			
			//reWeight
			int newWeight = amounts[  intsplit[1]  ] - intsplit[2];
			newWeight = newWeight * -1;
			intsplit[2] = newWeight;
			
			adjacencies.add(intsplit);
		}
		
		double[] d = new AllNewSalesman().runBellmanFordRun(origin, destination, adjacencies, towns, amounts[0]*-1 );
		
		if(d[destination] == Double.POSITIVE_INFINITY){
			System.out.println("IMPOSSIBLE");
			new AllNewSalesman().run();
			return;
		}
		
		ArrayList<Integer> zycleVertices = new ArrayList<Integer>();
		for( int[] edge: adjacencies )
			if(  d[  edge[0]  ] + edge[2] <  d[  edge[1]  ] )
				zycleVertices.add(  edge[1] );
			
		if(!zycleVertices.isEmpty()){
			//Ubervertex
			for( int vertex: zycleVertices ){
				int[] newEdge = new int[3];
				newEdge[0] = towns;
				newEdge[1] = vertex;
				newEdge[2] = 0;
				adjacencies.add(newEdge);
			}
			
			double[] newD = new AllNewSalesman().runBellmanFordRun(towns, destination, adjacencies, towns+1, amounts[0]*-1 );
			
			if(newD[destination] != Double.POSITIVE_INFINITY){
				System.out.println("ENDLESS PROFIT");
				new AllNewSalesman().run();
				return;
			}
		}
		System.out.println("BEST PROFIT: "+ d[destination]*-1);
		new AllNewSalesman().run();
	}
	
	private double[] runBellmanFordRun(int origin, int destination, ArrayList<int[]> adjacencies, int towns, int startAmount) {
		double[] d = new double[towns];
		int[] pre = new int[towns];
		
		for(int i=0; i< towns; i++){
			d[i] = Double.POSITIVE_INFINITY;
			pre[i] = -1;
		}
		
		
		d[origin] = startAmount;
		
		//edge[0] = source; edge[1] = destination; edge[2] = cost
		for(int i=1; i < towns; i++)
			for( int[] edge: adjacencies )
				if( d[  edge[0]  ] + edge[2] <  d[  edge[1]  ] ) {
					d[  edge[1]  ] = d[  edge[0]  ] + edge[2];
					pre[ edge[1] ] = edge[0];
				}
		return d;	
	}
}
